/**
 * Created by yangh on 2016/10/14.
 */

(function ($) {
	$(".leftNav li").on("click", function () {
		$(this).addClass("active").siblings().removeClass("active");
	});
	
	var floorTop = [];
    
    $("input[name='floor']").each(  
    		  
    		function(i,n){  
    		  
    			floorTop[i] = $(this).val();
    		  
    		}  
    		  
    		)   

	$(window).on("scroll", function () {
		var top = $(document).scrollTop();
		
		$(".leftNav li").each(function (index, ele) {
			if(top > $("#" + floorTop[index]).offset().top - 100){
				$(this).addClass("active").siblings().removeClass("active");
			}
			else{
				return false;
			}
		})
	})
})(jQuery)